package models

import (
	"goods_srv/basic/config"
	"time"
)

type CabinetAddress struct {
	Id        uint32    `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" json:"id"`
	Address   string    `gorm:"column:address;type:varchar(20);not null;" json:"address"`
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;" json:"created_at"`
	UpdateAt  time.Time `gorm:"column:update_at;type:datetime;not null;default:CURRENT_TIMESTAMP;" json:"update_at"`
	DeleteAt  time.Time `gorm:"column:delete_at;type:datetime;default:NULL;" json:"delete_at"`
}

func (a *CabinetAddress) TableName() string {
	return "cabinet_address"
}
func (a *CabinetAddress) AddressList() (list []CabinetAddress, err error) {
	err = config.DB.Find(&list).Error
	return
}
